# Original Package: Jan de Groot <jgc@archlinux.org>
# Maintainer: Lubosz Sarnecki <lubosz@gmail.com>

pkgname=gst-libav-git
_gitname=gst-libav
pkgver=1.9.2.1.2005.036da8b
pkgrel=1
pkgdesc="Gstreamer libav Plugin"
arch=('i686' 'x86_64')
license=('GPL')
url="http://gstreamer.freedesktop.org/"
depends=('gst-plugins-base-git' 'bzip2')
makedepends=('yasm')
options=(!libtool !emptydirs)
provides=("gst-libav=$pkgver-$pkgrel" "gst-ffmpeg=$pkgver-$pkgrel")
conflicts=("gst-libav" "gst-ffmpeg")

#patchaudio='626152dd6f2164537b7788c885f8570155e7f6dc..30a4a28793f2e0ff08aaea368b7c14317ac2ca21.patch'
source=('git+git://anongit.freedesktop.org/gstreamer/gst-libav'
#"$patchaudio"
)
sha256sums=('SKIP')

pkgver() {
  cd "$_gitname"
  version=$(grep AC_INIT configure.ac | sed 's/AC_INIT(GStreamer libav, //' | sed 's/,//')
  hash=$(git log --pretty=format:'%h' -n 1)
  revision=$(git rev-list --count HEAD)
  
  echo $version.$revision.$hash
}

prepare() {
  cd "$_gitname"
  #already in git!!! patch -Np1 -i "../${patchaudio}"

  ./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
    --disable-static --with-libav-extra-configure="--enable-runtime-cpudetect"
}

build() {
  cd "$_gitname"
  make
}

package() {
  cd "$_gitname"
  make DESTDIR="${pkgdir}" install
}
